package com.fourmob.poppyview.sample.slice;

import com.fourmob.poppyview.sample.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import com.fourmob.poppyview.librarys.PoppyViewHelper;
import ohos.agp.components.Component;
import ohos.agp.window.dialog.ToastDialog;


public class ScrollViewAbilitySlice extends AbilitySlice {
    private PoppyViewHelper mPoppyViewHelper;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_activity_scrollview);
        mPoppyViewHelper = new PoppyViewHelper(getAbility(), PoppyViewHelper.PoppyViewPosition.TOP);
        Component poppyView = mPoppyViewHelper.createPoppyViewOnScrollView(ResourceTable.Id_scrollView, ResourceTable.Layout_poppyview);
        poppyView.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                ToastDialog toastDialog =new ToastDialog(getContext());
                toastDialog.setText("Click me!");
                toastDialog.show();
            }
        });

    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
